package main

import (
	"fmt"
	"net/http"

	"./utils"
)

func myHandle(w http.ResponseWriter, r *http.Request) {
	w.Write([]byte("this is a Web serve 1r"))
	fmt.Println("header", r.Header)
	fmt.Println(r.URL)

}

func login(w http.ResponseWriter, r *http.Request) {

}

// func initDB() {
// 	path := strings.Join([]string{"root", ":", "Longhu258?", "@tcp(", "127.0.0.1", ":", "3306", ")/", "taobao", "?charset=utf8"}, "")
// 	DB, _ = sql.Open("mysql", path)
// }

func main() {

	//修改数据
	utils.Update(1, "baye")
	//插入一条数据
	type User struct {
		name string
	}

	var user = User{
		name: "八哥",
	}
	sql := "insert into user (name) values (?)"
	utils.Insert(sql, user.name)
	//initDB()
	// http.HandleFunc(commonApi("login"), login)
	// http.HandleFunc(commonApi("register"), myHandle)

	// http.ListenAndServe("127.0.0.1:8000", nil)

}

func commonApi(n string) string {
	return "/api/" + n
}
